package com.test1225;

public class Test12 {
    public static void main(String[] args) {
        // 返回arr与brr的差集
        int[] arr = {1,2,3,4,5};
        int[] brr = {3,4,5,6,7};
        int[] crr = m12(arr, brr);
        for (int c:crr) {
            System.out.println(c);
        }
    }
    public static int[] m12(int[] a,int[] b){
        int count=0;
        for(int i=0;i<a.length;i++){
            boolean m =true;
            for(int j=0;j<b.length;j++){
                if(a[i]==b[j]){
                    m =false;
                    break;
                }
            }
            if(m){
                count++;
            }
        }
        int[] newArr = new int[count];
        int newNum =0;
        for(int i=0;i<a.length;i++){
            boolean m =true;
            for(int j=0;j<b.length;j++){
                if(a[i]==b[j]){
                    m =false;
                }
            }
            if(m){
                newArr[newNum] = a[i];
                newNum++;
            }
        }
        return newArr;
    }
}
